<template>
  <div>
    <ul v-for="i in data" :key="i">
      <li>{{ i.title }}
        <button @click="tongguo(i.id)">通过</button>
        <button @click="butongguo(i.id)">未通过</button>
      </li>
    </ul>
  </div>
</template>

<script>
import axios from 'axios'

export default {
  name: "audit_news",
  data() {
    return {
      data: {}
    }
  },
  methods: {
    get_news() {
      axios.get('http://127.0.0.1:5000/get_news')
          .then(res => {
            this.data = res.data.list
          })
    },
    tongguo(id) {
      axios.post('http://127.0.0.1:5000/tongguo', {'id': id})
          .then(res => {
            console.log(res)
          })
    },
    butongguo(id) {
      axios.post('http://127.0.0.1:5000/notongguo', {'id': id})
          .then(res => {
            console.log(res)
          })
    }
  },
  mounted() {
    this.get_news()
  }
}
</script>

<style scoped>

</style>
